package com.ruoyi.web.controller.business;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.HealthDailyInfo;
import com.ruoyi.system.domain.HealthUserInfo;
import com.ruoyi.system.service.IHealthDailyInfoService;
import com.ruoyi.system.service.IHealthUserInfoService;

/**
 * 日报用户查询相关
 * @author 13568
 *
 */
@Controller
@RequestMapping("/healthinfo")
public class HealthinfoController  extends BaseController{

	
	 @Autowired
	 private IHealthDailyInfoService healthDailyInfoService;
	
	  @Autowired
	  private IHealthUserInfoService healthUserInfoService;
	 
	 @RequiresPermissions("healthinfo:queryByMobile")
	    @PostMapping("/queryByMobile")
	    @ResponseBody
	    public HealthDailyInfo queryByMobile(String userMobile,String today )
	    {
	       
	        HealthDailyInfo healthDailyInfo = healthDailyInfoService.queryByMobile(userMobile,today);
	        return healthDailyInfo;
	    }
	 
	 @RequiresPermissions("healthinfo:queryUserByMobile")
	    @PostMapping("/queryUserByMobile")
	    @ResponseBody
	    public HealthUserInfo queryUserByMobile(String userMobile)
	    {
	        HealthUserInfo healthUserInfo = healthUserInfoService.queryUserByMobile(userMobile);
	        return healthUserInfo;
	    }
	 
	   @RequiresPermissions("healthinfo:editByMobile")
	    @PostMapping("/editByMobile")
	    @ResponseBody
	    public AjaxResult editByMobile(HealthUserInfo healthUserInfo)
	    {
		   return toAjax(healthUserInfoService.updateHealthUserInfo(healthUserInfo));
	    }
	    
}
